<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        
        <script src = "jquery.js"></script>
        <script>
//            $(document).ready(function(){
//                $("#toutcoch").click(function(){
//                    
////                    alert("coché");
//                   if ($('#case3').attr('checked')==='checked') {
//                       alert("case1 cochée");
////                       $('#zonecocher').attr('checked',true);
//                   } else {
//                       alert("case1 non cochée");
////                       $('#zonecocher').attr('checked',false);
//                   } 
//                    
//                });
//            });
            
            
        function cocher(etat,kazkosh){
            with (document.formulaire) {
                
                if (etat===true){
                        for (i = 0; i < kazkosh.length; i++)
                            kazkosh[i].checked = true;    
                    } else {
                        for (i = 0; i < kazkosh.length; i++)
                            kazkosh[i].checked = false;    
                    }
            }
        }     

        </script>
        
    </head>
    <body>
        
        <!--            <div id="formulaire">-->
        <form name="formulaire" action="">

            <div id="div1">
                <input type="checkbox" name="toutcoch" id="toutcoch1" onclick="cocher(this.checked,casecoch1)">tout cocher/décocher
                <ul id="zonecocher1">
                    <li><input type="checkbox" name="casecoch1">case 1</li>
                    <li><input type="checkbox" name="casecoch1">case 2</li>
                    <li><input type="checkbox" name="casecoch1">case 3</li>
                    <li><input type="checkbox" name="casecoch1">case 4</li>
                </ul>
            </div>    

            <div id="div2">
                <input type="checkbox" name="toutcoch" id="toutcoch2" onclick="cocher(this.checked,casecoch2)">tout cocher/décocher
                <ul id="zonecocher2">
                    <li><input type="checkbox" name="casecoch2">case 1</li>
                    <li><input type="checkbox" name="casecoch2">case 2</li>
                    <li><input type="checkbox" name="casecoch2">case 3</li>
                    <li><input type="checkbox" name="casecoch2">case 4</li>
                </ul>
            </div>    

            <div id="div3">
                <input type="checkbox" name="toutcoch" id="toutcoch3" onclick="cocher(this.checked,casecoch3)">tout cocher/décocher
                <ul id="zonecocher3">
                    <li><input type="checkbox" name="casecoch3">case 1</li>
                    <li><input type="checkbox" name="casecoch3">case 2</li>
                    <li><input type="checkbox" name="casecoch3">case 3</li>
                    <li><input type="checkbox" name="casecoch3">case 4</li>
                </ul>
            </div>    
        </form>

    </body>
</html>
